From ab81df7f3d317281a05caec18e2cfd89dc26bc7a Mon Sep 17 00:00:00 2001
From: Armand Philippot <git@armandphilippot.com>
Date: Tue, 28 Nov 2023 15:09:04 +0100
Subject: refactor(services): avoid nested fetchers

If we use fetchPostsCount inside fetchAllPostsSlugs, we might have
problems to test fetchAllPostsSlugs failure. So it is better to let
the consumer pass the posts count as an argument. The same applies
to thematics and topics.
---
 src/pages/thematique/[slug].tsx | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

(limited to 'src/pages/thematique/[slug].tsx')

diff --git a/src/pages/thematique/[slug].tsx b/src/pages/thematique/[slug].tsx
index a44c98b..f8c3404 100644
--- a/src/pages/thematique/[slug].tsx
+++ b/src/pages/thematique/[slug].tsx
@@ -216,7 +216,8 @@ export const getStaticProps: GetStaticProps<ThematicPageProps> = async ({
 };
 
 export const getStaticPaths: GetStaticPaths = async () => {
-  const slugs = await fetchAllThematicsSlugs();
+  const thematicsCount = await fetchThematicsCount();
+  const slugs = await fetchAllThematicsSlugs(thematicsCount);
   const paths = slugs.map((slug) => {
     return { params: { slug } };
   });
-- 
cgit v1.2.3

